package moodish.client.gui;

import java.awt.Color;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;

public class LogWindow extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton login = new JButton("Login");
	private JTextField nickNameField = new JTextField();
	private MoodishClientGui gui;
	
	public LogWindow(MoodishClientGui gui) {
		this.setGui(gui);
		setLayout(new GridLayout(5, 5));

		for (int i = 0; i < 24; i++) {
			if (i == 12) {
				add(visiblePanel());
			}
			JPanel invisiblePanel = new JPanel();
			invisiblePanel.setOpaque(false);
			add(invisiblePanel);
		}
		setBackground(new Color(0,0,50,90));
	}
	
	private JPanel visiblePanel() {

		JPanel panel = new JPanel();	panel.setOpaque(false);
		Border border = BorderFactory.createTitledBorder("Login");
		panel.setBorder(border);
		JLabel nickNameLabel = new JLabel("       NickName    "); nickNameLabel.setOpaque(false);

		GridLayout layout = new GridLayout(3, 0);
		panel.setLayout(layout);
		panel.add(nickNameLabel);
		panel.add(nickNameField);
		panel.add(login);
		return panel;
	}


	public JButton getLogin() {
		return login;
	}
	
	public MoodishClientGui getGui() {
		return gui;
	}

	public void setGui(MoodishClientGui gui) {
		this.gui = gui;
	}
	
	public JTextField getNickNameField() {
		return nickNameField;
	}

}
